﻿#define XML
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using System.Data;
using System.Web.SessionState;

[WebService ( Namespace = "http://tempuri.org/" )]
[WebServiceBinding ( ConformsTo = WsiProfiles.BasicProfile1_1 )]
[ScriptService]
public class validator_webservice : System.Web.Services.WebService
{

	[WebMethod]
	[ScriptMethod]
	public SortedDictionary<string, object> CheckNickname ( string value )
	{
		this.Context.Response.Cache.SetNoStore ( );

		SortedDictionary<string, object> values = new SortedDictionary<string, object> ( );
		values.Add ( "value", value );
		values.Add ( "tip", value == "abc" ? "<font color=\"red\">abc 这个昵称已经被注册了, 请换一个吧</font>" : null );
		values.Add ( "valid", value != "abc" );

		// new object { value = "abc" }
		return values;
	}

	[WebMethod]
	[ScriptMethod]
	public string RegisterWeibo ( string email, string password, string nickname, int age )
	{
		this.Context.Response.Cache.SetNoStore ( );

		return string.Format("成功注册 {0}, {1}, {2}, {3}", email, password, nickname, age);
	}

}
